{extend name="layout:base" /}{/block}
{block name="content"}
<body>
<div class="black_overlay" id="fade"></div>
<div class="popup" id="gword" style="display: none">
	<h2>密码修改</h2>
            <ul>
            <li><input name="" type="text" class="input01"  value="旧密码" onfocus="if (this.value=='旧密码')this.value=''" id="pwd"/></li>
            <li><input name="" type="password" class="input01"  value="新密码" onfocus="if (this.value=='新密码')this.value=''" id="repwd"/></li>
            <li><input name="" type="password" class="input01"  value="重复新密码" onfocus="if (this.value=='重复新密码')this.value=''" id="repwd1"/></li>
            </ul>
            <h3><p style="display: none;color:red;" id="msgInfo">提示：<span id="errorMsg"></span> ，请重新修改！</p></h3>
            <p><input name="" type="button" class="button" value="确定修改" id="editData"/></p>
            <p><a href="javascript:void(0)" onclick="document.getElementById('gword').style.display='none';document.getElementById('fade').style.display='none'">取消</a></p>
</div>
<div class="popup" id="changepwd" style="display: none">
    <h2>邮箱重置密码</h2>
    <ul>
        <li><input name="" type="text" class="input01"  value="用户名" onfocus="if (this.value=='用户名')this.value=''" id="logname"/></li>
        <li><input name="" type="text" class="input01"  value="邮箱" onfocus="if (this.value=='邮箱')this.value=''" id="email"/></li>
    </ul>
    <h3><p style="display: none;color:red;" id="msgInfo1">提示：<span id="errorMsg1"></span> ，请重新修改！</p></h3>
    <p><input name="" type="button" class="button" value="确定提交" id="changeEdit"/></p>
    <p><a href="javascript:void(0)" onclick="document.getElementById('changepwd').style.display='none';document.getElementById('fade').style.display='none'">取消</a></p>
</div>
	<div class="col-auto">
		<div class="col-1">
			<div class="content" style="position:relative; overflow:hidden">
                <div class="location">
                <p><a href="#" class="a01">返回</a>您的当前位置：<a href="#">数据管理</a><span>&gt;</span><a href="#">景区景点</a><span>&gt;</span>列表查询</p>
                </div>
                <input type="hidden" name="id" id="id" value="{$lists.id}">
                <div class="main">
                    <div class="main_list">
                    <table width="100%" border="0" class="table_left">
                      <tr>
                        <td width="15%" nowrap>账号</td>
                        <td nowrap>{$lists.logname}</td>
                      </tr>
                      <tr>
                        <td nowrap>密码</td>
                        <td nowrap><a href="javascript:void(0)" onclick="document.getElementById('gword').style.display='block';document.getElementById('fade').style.display='block'">[ 修改密码 ]</a> <a href="javascript:void(0)" onclick="document.getElementById('changepwd').style.display='block';document.getElementById('fade').style.display='block'">[ 重置密码 ]</a></td>
                      </tr>
                      <tr>
                        <td nowrap>管理员姓名</td>
                        <td nowrap>{$lists.uname}</td>
                      </tr>
                      <tr>
                        <td nowrap>账号类型</td>
                        <td nowrap>{$lists.role_name}</td>
                      </tr>
                      <tr>
                        <td nowrap>邮箱</td>
                        <td nowrap>{$lists.email}</td>
                      </tr>
                      <tr>
                        <td nowrap>最后登录时间</td>
                        <td nowrap><?php echo date('Y-m-d H:i:s',$lists['lastlog'])?></td>
                      </tr>
                      <tr>
                        <td nowrap>最后登录IP</td>
                        <td nowrap>{$lists.lastip}</td>
                      </tr>
                    </table>
                    </div>
                </div>
                
			</div>
		</div>
	</div>
</div>
{/block}
{block name="js"}
<script type="text/javascript" src="/static/js/newtab.js"></script>
<script type="text/javascript">
    $(function () {
        $('#editData').on('click',function () {
            var pwd = $("#pwd").val();
            var repwd =$("#repwd").val();
            var repwd1 = $("#repwd1").val();
            var id = $("#id").val();
            $.ajax({
                type: "post",
                url: "/admin/login/editpwd",
                data: "id="+id+"&pwd="+pwd+"&repwd="+repwd+"&repwd1="+repwd1,
                success: function(msg){
                    msg = $.parseJSON(msg);
                    if(msg.flag=="true"){
                        alert('修改成功')
                        window.location.href="/admin/admin/index";
                        ocument.getElementById('gword').style.display='none';document.getElementById('fade').style.display='none'
                    }else{
                        $("#msgInfo").show();
                        $("#errorMsg").text(msg.msg);
                    }
                }
            });
        })
        $('#changeEdit').on('click',function () {
            var logname = $("#logname").val();
            var email =$("#email").val();
            $.ajax({
                type: "post",
                url: "/admin/login/setnewpwd",
                data: "logname="+logname+"&email="+email,
                success: function(msg){
                    msg = $.parseJSON(msg);
                    if(msg.flag=="true"){
                        alert('重置成功')
                        window.location.href="/admin/admin/index";
                        ocument.getElementById('changepwd').style.display='none';document.getElementById('fade').style.display='none'
                    }else{
                        $("#msgInfo1").show();
                        $("#errorMsg1").text(msg.msg);
                    }
                }
            });
        })
    })
</script>
{/block}
</body>
</html>
